RFE-9311: Add workload partitioning support for must-gather pods - #2321
RFE-9311: Add workload partitioning support for must-gather pods#2321midu16 wants to merge 1 commit into
Conversation
When CPU partitioning is enabled (cpuPartitioningMode: AllNodes), must-gather pods now carry the workload partitioning annotation so CRI-O pins them to Reserved CPU cores, preventing interference with Isolated application workloads. Changes: - Query Infrastructure resource to detect CPU partitioning mode - Annotate temp namespace with workload.openshift.io/allowed - Annotate pods with target.workload.openshift.io/management - Fail open if Infrastructure resource is unavailable
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@midu16: This pull request references RFE-9311 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the feature request to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: midu16 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
WalkthroughMust-gather now detects cluster-wide CPU partitioning and conditionally annotates its temporary namespace and pods for management workload scheduling. Tests cover enabled, disabled, and missing Infrastructure configurations. ChangesMust-gather CPU partitioning
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant MustGatherOptions
participant InfrastructureAPI
participant Namespace
participant Pod
MustGatherOptions->>InfrastructureAPI: Read CPUPartitioning setting
InfrastructureAPI-->>MustGatherOptions: Return partitioning status
MustGatherOptions->>Namespace: Create with management workload annotation when enabled
MustGatherOptions->>Pod: Create with management scheduling annotation when enabled
🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
pkg/cli/admin/mustgather/mustgather_test.go (1)
790-801: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCompare the complete namespace annotation map.
The current assertions only inspect one key through multiple conditionals, so regressions to the other annotations would go unnoticed. Build the expected annotation map for each case and compare it with
cmp.Diff.Proposed test adjustment
- _, exists := ns.Annotations[namespaceWorkloadAllowedAnnotation] - if tc.expectAnnotation && !exists { - t.Errorf("expected %s annotation, got annotations: %v", namespaceWorkloadAllowedAnnotation, ns.Annotations) - } - if !tc.expectAnnotation && exists { - t.Errorf("did not expect %s annotation when partitioning is disabled", namespaceWorkloadAllowedAnnotation) - } - if tc.expectAnnotation && ns.Annotations[namespaceWorkloadAllowedAnnotation] != "management" { - t.Errorf("expected annotation value %q, got %q", "management", ns.Annotations[namespaceWorkloadAllowedAnnotation]) + expectedAnnotations := map[string]string{ + "oc.openshift.io/command": "oc adm must-gather", + "openshift.io/node-selector": "", + } + if tc.expectAnnotation { + expectedAnnotations[namespaceWorkloadAllowedAnnotation] = "management" + } + if diff := cmp.Diff(expectedAnnotations, ns.Annotations); diff != "" { + t.Errorf("namespace annotations differ (-want +got):\n%s", diff) }As per coding guidelines, tests should assemble expected objects and compare them using
google/go-cmp.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/cli/admin/mustgather/mustgather_test.go` around lines 790 - 801, Update the table-driven test around newNamespace to construct the complete expected annotation map for each test case and compare it with ns.Annotations using cmp.Diff. Remove the individual namespaceWorkloadAllowedAnnotation existence and value conditionals, while preserving each case’s expected annotations.Source: Coding guidelines
pkg/cli/admin/mustgather/mustgather.go (1)
322-322: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument all changed Go functions.
The changed declarations omit required descriptive comments:
pkg/cli/admin/mustgather/mustgather.go#L322-L322: document the Infrastructure lookup and fail-open behavior.pkg/cli/admin/mustgather/mustgather.go#L1127-L1127: document conditional namespace workload annotation.pkg/cli/admin/mustgather/mustgather_test.go#L725-L725: document the detection test.pkg/cli/admin/mustgather/mustgather_test.go#L773-L773: document the namespace annotation test.As per coding guidelines, all exported and unexported Go functions must have descriptive comments.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/cli/admin/mustgather/mustgather.go` at line 322, Document all four changed Go functions with concise comments: in pkg/cli/admin/mustgather/mustgather.go lines 322-322, describe isCPUPartitioningEnabled’s Infrastructure lookup and fail-open behavior; in lines 1127-1127, describe the conditional namespace workload annotation; in pkg/cli/admin/mustgather/mustgather_test.go lines 725-725 and 773-773, describe the CPU partitioning detection and namespace annotation tests respectively.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@pkg/cli/admin/mustgather/mustgather_test.go`:
- Around line 790-801: Update the table-driven test around newNamespace to
construct the complete expected annotation map for each test case and compare it
with ns.Annotations using cmp.Diff. Remove the individual
namespaceWorkloadAllowedAnnotation existence and value conditionals, while
preserving each case’s expected annotations.
In `@pkg/cli/admin/mustgather/mustgather.go`:
- Line 322: Document all four changed Go functions with concise comments: in
pkg/cli/admin/mustgather/mustgather.go lines 322-322, describe
isCPUPartitioningEnabled’s Infrastructure lookup and fail-open behavior; in
lines 1127-1127, describe the conditional namespace workload annotation; in
pkg/cli/admin/mustgather/mustgather_test.go lines 725-725 and 773-773, describe
the CPU partitioning detection and namespace annotation tests respectively.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: eecd613f-7845-4fa7-8eac-ea06fc83d1f8
📒 Files selected for processing (2)
pkg/cli/admin/mustgather/mustgather.gopkg/cli/admin/mustgather/mustgather_test.go
|
@midu16: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
When CPU partitioning is enabled (cpuPartitioningMode: AllNodes), must-gather pods now carry the workload partitioning annotation so CRI-O pins them to Reserved CPU cores, preventing interference with Isolated application workloads.
Changes:
Summary by CodeRabbit
Enhancements
Tests